<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ page import="com.onlineauction.helpers.Constants" %>
<%@ page import="com.onlineauction.helpers.Constants.Category" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Add Item</title>
<link rel="stylesheet"
	href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
<link rel="stylesheet" href="style.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<script src="timepicker_addon.js"></script>
</head>
<%
	// redirect to Home if session is not set (user is not logged in yet)
	String username = (String) session.getAttribute(Constants.USERNAME);
	if (username == null) {
		request.getRequestDispatcher("/Home").forward(request, response);
	}
%>

<body>
    <%
        String message = (String)request.getAttribute(Constants.MESSAGE);
        if (message != null && message.length() != 0) {
        	out.println(message);
        }
    %>
	<div class="wrapper">
		<div id="Content">
			<div id="Header">
				<H1>Add Item</H1>
				<div id="LogOutButtonDiv" align="left">
					<a href="/Home">Home</a> <a href="LogoutAccount">Logout</a>
				</div>
			</div>
			<hr />
			<div id="MainContent">
				<form action="AddItem" method="post">					
					<table>
						<tr>
							<td align="right">Item name:</td>
							<td align="left"><input type="text" name=<%=Constants.PRODUCT_NAME%> /></td>
						</tr>						
						<tr>
						    <td align="right">Category:</td>
						    <td align="left">
						        <select name=<%=Constants.CATEGORY%> size="1">
						            <%
						                Category[] categories = Constants.Category.values();
						                for (Category c : categories) {						            						    
						            %>
						                <option value=<%=c.toString()%>><%=c.toString()%></option>
						            <%  } %>										 
						        </select>       		        						       
						    </td>
						</tr>
						<tr>
							<td></td>
							<td><input type="submit" value="Add" /></td>
						</tr>
					</table>
				</form>
			</div>
			<!-- end MainContent -->
		</div>
		<!-- end Content -->
	</div>
	<!-- end wrapper -->
</body>
</html>
